
import { _decorator, Component, Node } from 'cc';
import { BaseItem2D } from '../BaseItem2D';
import { Monster } from '../Monster';
import { Player } from '../Player';
const { ccclass, property } = _decorator;


 
@ccclass('BattleMapGrid')
export class BattleMapGrid  {
    static pool:BattleMapGrid[]=[]
	static create():BattleMapGrid{
		let grid=this.pool.pop()
		if(!grid){
			grid=new BattleMapGrid()
		}
		return grid
	}
	
	
	player:Player=null
	monsters:Monster[]=[]
	collisionItems:BaseItem2D[]=[] //碰撞分离用的
	
	reset(){
		this.player=null
		this.monsters.length=0
		this.collisionItems.length=0
	}
	recover(){
		this.reset()
		BattleMapGrid.pool.push(this)
	}
	
}
